<?php
$img = imgToCanvas('2b.png');

header('Content-type:image/jpeg');
imagejpeg($img);
/*图片变成画布
*@param1 图片的路径
 */
function imgToCanvas($picture){
    $picture_info = getimagesize($picture);
    // echo '<pre>';
    // print_r($dest_info);
    switch ($picture_info['mime']) {
	    case 'image/jpeg':
	    	$img_picture = imagecreatefromjpeg($picture);
	    	break;
        case 'image/png':
	    	$img_picture = imagecreatefrompng($picture);
	    	break;
	    case 'image/gif':
	    	$img_picture = imagecreatefromgif($picture);
	        break;
    }
    return $img_picture;
}
?>